package field_method04;

public class Student  extends  Person{
    private String no;
    private double scoreEn;
    private  double scoreMath;
    private  double scoreCh;
    public Student(String name, String sex,int age,String no,double scoreEn,double scoreMath ,double scoreCh){
        super(name, sex, age);
        this.no=no;
        this.scoreEn=scoreEn;
        this.scoreMath=scoreMath;
        this.scoreCh=scoreCh;
    }
    public double aver(){
        return (scoreCh+scoreMath+scoreEn)/3;
    }
    public double max() {
        return Math.max(Math.max(scoreEn, scoreMath), scoreCh);
    }
    public double min(){
        return Math.min(Math.min(scoreEn,scoreMath),scoreCh);
    }

    @Override
    public String toString() {
        return  super.toString() +
                "学号为'" + no + '\'' +
                ", 平均成绩为" + aver() +
                ", 最高成绩为" + max() +
                ", 最低成绩为" + min() ;
    }

}

